package cn.wolfcode.mq;

/**
 * @ClassName ModifyLocalFlagMQConsumer
 * @Author VCR
 * @Date 2022/1/3 12:28
 * @Version 1.0
 */

import cn.wolfcode.web.controller.OrderInfoController;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 修改本地标识MQ
 */
@Component
@Slf4j
@RocketMQMessageListener(topic = MQConstant.CANCEL_SECKILL_OVER_SIGE_TOPIC,consumerGroup = "ModifyLocalFlagMQConsumer",messageModel = MessageModel.BROADCASTING)
public class ModifyLocalFlagMQConsumer implements RocketMQListener<Long> {  // 消息为seckillId 类型即为Long

    @Override
    public void onMessage(Long seckillId) {
        // 修改本地标识 (修改Map中key:seckillId value的值)
        OrderInfoController.local_flag.put(seckillId,false);
        log.info("数据同步成功");
    }
}
